import 'package:baselib/utils/px_base_util.dart';
import 'package:flutter/material.dart';

class CommCardView extends StatelessWidget{
  final EdgeInsetsGeometry margin;
  final EdgeInsetsGeometry padding;
  final double elevation;
  final double width;
  /// The background color.
  final Color color;
  /// The shadow color.
  final Color shadowColor;
   Clip clipBehavior;
   BorderRadius borderRadius;
   Widget child;
   final double blurRadius;
   final double spreadRadius;//黑色扩散的程度
  final Gradient gradient;
  final BoxBorder border;
  final BoxDecoration foregroundDecoration;
  CommCardView({
    @required this.child,
    this.margin=const EdgeInsets.all(0),
    this.padding=const EdgeInsets.all(0),
    this.elevation,
    this.width,
    this.color=const Color(0xFFffffff),
    this.shadowColor=const Color.fromARGB(30, 0, 0, 0),
    this.clipBehavior= Clip.antiAlias,
    this.borderRadius,
    this.blurRadius,
    this.spreadRadius,
    this.gradient,
    this.border,
    this.foregroundDecoration,
  });

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return
      Container(
        width: width,
        margin: margin,
        foregroundDecoration: foregroundDecoration,
        decoration: BoxDecoration(
          color: color,
          borderRadius: borderRadius,
          gradient: gradient,
          border: border,
          //主要用来设置阴影设置
          boxShadow: [
            BoxShadow(
              blurRadius: blurRadius??PxBaseUtil().px_10,//阴影模糊层度由blurRadius大小决定（大就更透明更扩散）
              spreadRadius: spreadRadius??PxBaseUtil().px_1,//阴影模糊大小由spreadRadius决定
              color: shadowColor==null?shadowColor:Color.fromARGB(5, 0, 0, 0),//阴影颜色深浅
            ),
          ],
        ),
        child: Padding(
          padding: padding,
          child: child,
        )
    );

//    Container(
//      margin: margin,
//      child: PhysicalModel(
//          color: color,
//          //z轴设置 关键
//          elevation: elevation,
//          borderRadius: borderRadius,
//          clipBehavior: clipBehavior,
//          //阴影颜色设置 关键
//          shadowColor:shadowColor,//阴影颜色深浅
//          child: Padding(
//            padding:padding,
//            child: child,
//          )
//      ),
//    );
  }



}